import React,{useEffect,useState}from "react";
import PubSub from "pubsub-js";

import style from './index.module.css'
const {real_name,money,lastPage} = style

export default function GoRealName(){
    const [memberDiscount,setMemberDiscount] = useState(0)
    useEffect(() => {
        const pub = PubSub.subscribe('memberDiscount',(message,data:number)=>[
            setMemberDiscount(data)
        ])
        return () => {
            PubSub.unsubscribe(pub)
        }
    }, [])
    return (
        <ul className={real_name}>
            <li>实名认证</li>
            <li>开通优享会员，本单省<span className={money}>{memberDiscount}</span>元，多买多省噢～</li>
            <li>去开通<span className={lastPage}></span></li>
        </ul>
    )
}